//
//  AddressViewController.m
//  MyDian
//
//  Created by dllo on 16/9/26.
//  Copyright © 2016年 m. All rights reserved.
//

#import "AddressViewController.h"
#import "UIView+Frame.h"
#import "AddressSecondViewController.h"
@interface AddressViewController ()
@property (nonatomic, strong)UIButton *buttonaddress;
@end

@implementation AddressViewController

- (void)viewDidLoad {
    [super viewDidLoad];
      self.view.backgroundColor = [UIColor colorWithWhite:0.918 alpha:1.000];
      UIView *viewRed = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, 64)];
      [self.view addSubview:viewRed];
      viewRed.backgroundColor = [UIColor redColor];
      viewRed.userInteractionEnabled = YES;
      [self letfButton];
      self.title = @"地址管理";
      UIColor * color = [UIColor whiteColor];
      NSDictionary * dict=[NSDictionary dictionaryWithObject:color forKey:NSForegroundColorAttributeName];
      self.navigationController.navigationBar.titleTextAttributes = dict;
      self.navigationController.navigationBar.barStyle = UIStatusBarStyleDefault;
      [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
      [self createButton];
}
- (void)createButton {
      _buttonaddress = [[UIButton alloc]initWithFrame:CGRectMake(10, 74, self.view.width - 20, 60)];
      [self.view addSubview:_buttonaddress];
      _buttonaddress.backgroundColor = [UIColor whiteColor];
      [_buttonaddress setTitle:@"新增地址" forState:UIControlStateNormal];
      [_buttonaddress setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
      _buttonaddress.titleLabel.font = [UIFont systemFontOfSize:18];
      _buttonaddress.titleLabel.font = [UIFont fontWithName:@"Helvetica-BoldOblique" size:18];
      [_buttonaddress addTarget:self action:@selector(handleaddress:) forControlEvents:UIControlEventTouchUpInside];
      [_buttonaddress.layer setCornerRadius:3.0]; //设置矩形四个圆角半径


}

- (void)handleaddress:(UIButton *)address {
      AddressSecondViewController *vc = [[AddressSecondViewController alloc]init];
      [self.navigationController pushViewController:vc animated:YES];

}
- (void)letfButton {
      self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn_back"] style:UIBarButtonItemStylePlain target:self action:@selector(handleLeft)];
}
- (void)handleLeft {
      [self.navigationController popViewControllerAnimated:YES];
}
//- (void)viewWillAppear:(BOOL)animated {
//      self.hidesBottomBarWhenPushed = YES;
//      
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
